#light
namespace Demos.ParserWeb

open System
open System.IO
open System.Web
open System.Web.UI

type GetImage() = 
  inherit System.Web.UI.Page()

  override this.OnInit (e:System.EventArgs) =
    let id = new Guid(this.Request.QueryString.get_Item("id"))    
    let file = this.Server.MapPath("~/App_Data/"+id.ToString("D")+".png")
    let buffer = File.ReadAllBytes(file)
    File.Delete(file)
    this.Response.OutputStream.Write(buffer,0,buffer.Length)
    this.Response.End()
